/**
 * @(#)inicio.java
 *
 *
 * @author 
 * @version 1.00 2009/5/1
 */
import javax.microedition.lcdui.*;
import java.io.IOException;

public class miWaitScreen extends Canvas implements Runnable
 {
 
 	private int posy;
 	private Image[] ic; 
 	private boolean fnHilo=true;
 	private int ind;	
 		
 	public miWaitScreen(){
 		posy=(this.getWidth()/2);
 		ic=new Image[12];
 		try{
 			creaImagenes();
 		}catch(IOException exe){;}
 		new Thread(this).start();
		setFullScreenMode(true);
 	}
 	
 	private void creaImagenes()throws IOException{
 		for(int i=1;i<=12;i++)ic[i-1]=Image.createImage("/img/"+i+".dat");
 	}
 	
 	public void paint(Graphics g){
 		g.setColor(255,255,255);
 		g.fillRect(0,0,getWidth(),getHeight());
 		g.setColor(0, 0, 0);
 		g.setFont(Font.getFont(32, 0, 0));
 		g.drawImage(ic[ind],getWidth()/2,posy,2|1);
 		g.drawString("Conectando..",getWidth()/2,posy+40,0x10 | 1);
	
 	} 
 	public void run(){
 	 	while(fnHilo){
 	 		if(ind==11){
 				ind=0;
 			}
 			else{
 				try {
 				repaint();
 				ind++;
					Thread.sleep(80);
				} catch (InterruptedException e) {;}
 			}
 	 	}	
 	}
 	public void finHilo(){
 			fnHilo=false;
    }
 } 	